package com.benny_driving.thread;

import android.os.Handler;

import com.benny_driving.act.PerInfoAct;
import com.benny_driving.entity.PerInfo;
import com.benny_driving.http.dao.impl.HttpDaoImpl;

public class UpdatePerInfoThread extends Thread {
	private static Handler handler = null;
	private PerInfo perInfo = null;

	public UpdatePerInfoThread(PerInfo perInfo) {
		this.perInfo = perInfo;
		handler = new Handler();
	}

	@Override
	public void run() {
		try {
			boolean f = HttpDaoImpl.getInstance().updatePerInfo(perInfo);
			PerInfoAct.handler.sendMessage(handler.obtainMessage(
					PerInfoAct.SUBMIT_DATA, f));
		} catch (Exception e) {
			PerInfoAct.handler.sendMessage(handler.obtainMessage(
					PerInfoAct.NETWORK_ERROR, e.getMessage()));
		} finally {
			Thread.currentThread().interrupt();
		}
	}
}
